package ControllerLayer;

import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * The test class testToolCtr.
 *
 * @author  (your name)
 * @version (a version number or a date)
 */
public class testToolCtr
{
    private ControllerLayer.ToolCtr toolC1;
    /**
     * Default constructor for test class testToolCtr
     */
    public testToolCtr()
    {
      toolC1 = toolC1.getInstance();  
    }

    /**
     * Sets up the test fixture.
     *
     * Called before every test case method.
     */
    @Before
    public void setUp()
    {
           toolC1.createToolDescription("svensknøjle", 50.0);
           toolC1.createToolDescription("gravmaskine", 1000.0);
           toolC1.createTool(1, 1220);
           toolC1.createTool(1, 2412);
    }

    /**
     * Tears down the test fixture.
     *
     * Called after every test case method.
     */
    @After
    public void tearDown()
    {
    }

    @Test
     public void testCreateToolDescription()
    {
         assertEquals("svensknøjle", toolC1.getToolDescription(1).getDescription());
         assertEquals("gravmaskine", toolC1.getToolDescription(2).getDescription());
//          assertEquals(50.0, toolC1.getToolDescription(1).getPrice());
    }
    
    @Test
    public void deleteTool()
    {
        toolC1.deleteTool(1, 2412);
        assertNull(toolC1.getTool(1, 2412)); 
    }
    
    @Test
    public void testCreateTool()
    {
        long t = toolC1.getTool(1, 1220).getSerialNumber();
        assertEquals((long) 1220,t);
    }
}


